<template>
    <a-form layout="inline">
        <a-row :gutter="24">
            <a-col :md="8" :sm="24">
                <a-form-item label="面试官">
                    <a-select v-model="params.memberId" placeholder="请选择" :allowClear="true">
                        <a-select-option v-for="(item, index) in members" :key="index"
                                         :value="item.id">{{item.title + ' ' + item.name}}
                        </a-select-option>
                    </a-select>
                </a-form-item>
            </a-col>
            <a-col :md="8" :sm="24">
                <a-form-item label="面试时间">
                    <a-range-picker v-model="params.arrangedTime"/>
                </a-form-item>
            </a-col>
            <a-col :md="8" :sm="24">
                <span class="table-page-search-submitButtons">
                    <a-button type="primary" @click="query" :loading="loading">查询</a-button>
                    <a-button style="margin-left: 8px" @click="params = {}">重置</a-button>
                </span>
            </a-col>
        </a-row>



    </a-form>
</template>

<script>
    export default {
        name: "InterviewFilter",
        props: {
            members: {
                type: Array,
                default: () => null
            },
            loading: {
                type: Boolean,
                default: false
            }
        },
        data() {
            return {
                params: {}
            }
        },
        methods: {
            query() {
                this.parseTime('arrangedTime')
                this.$emit('query', this.params)
            },
            parseTime(key) {
                let legal = this.params[key] && this.params[key].length === 2
                this.params[key + 'Begin'] = legal && this.params[key][0].valueOf() || null
                this.params[key + 'End'] = legal && this.params[key][1].valueOf() || null
            }
        }
    }
</script>
